<template>
  <div>
    <h1>这是welCome页面</h1>
  </div>
</template>

<script setup>
import { onMounted, onUnmounted } from "vue";
let timer;

onMounted(() => {
  timer = setInterval(() => {
    console.log("hi");
  }, 500);
  console.log("welCom页面挂载成功了");
});
onUnmounted(() => {
  // 应用场景:解绑事件、取消定时器
  clearInterval(timer);
  console.log("welCom页面卸载成功了");
});
</script>

